//
//  GoodShopTableViewCell.m
//  BTRIP
//
//  Created by johnbk on 15/11/12.
//  Copyright © 2015年 johnbk. All rights reserved.
//

#import "GoodShopTableViewCell.h"

@implementation GoodShopTableViewCell

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
-(void)dealloc{
	[_buttonOfAddress release];
	[_imgView release];
	[_labelOfAddress release];
	[_labelOfConsumption_per release];
	[_labelOfName release];
	[_labelOfTitle release];
	[_goodShopModel release];
	[super dealloc];
}
+ (GoodShopTableViewCell *)tableView:(UITableView *)tableView{
	static NSString *cellIdentifier = @"GoodShopTableViewCellIdentifier";
	GoodShopTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
	if (!cell) {
		cell = [[GoodShopTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
	}
	return cell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
	self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
	if (self) {
		[self createView];
	}
	return self;
}
- (void)createView{
	self.imgView = [[UIImageView alloc]init];
	[self.contentView addSubview:self.imgView];
	[self.imgView release];
	self.labelOfName = [[UILabel alloc]init];
	[self.contentView addSubview:self.labelOfName];
	[self.labelOfName release];
	self.labelOfConsumption_per = [[UILabel alloc]init];
	[self.contentView addSubview:self.labelOfConsumption_per];
	[self.labelOfConsumption_per release];
	self.buttonOfAddress = [UIButton buttonWithType:UIButtonTypeCustom];
	[self.buttonOfAddress setBackgroundImage:[UIImage imageNamed:@"iconfont-icon30"] forState:UIControlStateNormal];
	[self.contentView addSubview:self.buttonOfAddress];
	self.labelOfTitle = [[UILabel alloc]init];
	[self.contentView addSubview:self.labelOfTitle];
	[self.labelOfTitle release];
}
-(void)layoutSubviews{
	[super layoutSubviews];
	self.imgView.frame = CGRectMake(5, 0, self.frame.size.width - 10, 200);
	self.labelOfName.frame = CGRectMake(self.imgView.frame.origin.x, self.imgView.frame.origin.y + 5 + self.imgView.frame.size.height, 80, 30);
	self.labelOfName.font = [UIFont systemFontOfSize:12];
	self.labelOfConsumption_per.frame = CGRectMake(self.frame.size.width - 100, self.labelOfName.frame.origin.y, 80, self.labelOfName.frame.size.height);
	self.labelOfConsumption_per.font = [UIFont systemFontOfSize:10];
	self.buttonOfAddress.frame = CGRectMake(self.imgView.frame.origin.x, self.labelOfName.frame.origin.y + 5 + self.labelOfName.frame.size.height, 30, 30);
	self.labelOfAddress.frame = CGRectMake(self.buttonOfAddress.frame.origin.x + 5 + self.buttonOfAddress.frame.size.width, self.buttonOfAddress.frame.origin.y, 260, self.buttonOfAddress.frame.size.height);
	self.labelOfAddress.font = [UIFont systemFontOfSize:10];
	self.labelOfAddress.textColor = [UIColor darkGrayColor];
	self.labelOfTitle.frame = CGRectMake(self.labelOfConsumption_per.frame.origin.x + 5, self.buttonOfAddress.frame.origin.y, self.labelOfConsumption_per.frame.size.width - 10, self.buttonOfAddress.frame.size.height);
	self.labelOfTitle.font = [UIFont systemFontOfSize:10];
	self.labelOfTitle.textColor = [UIColor darkGrayColor];
	self.labelOfTitle.layer.cornerRadius = 5;
	
	
}
-(void)setGoodShopModel:(GoodShopModel *)goodShopModel{
	if (_goodShopModel != goodShopModel) {
		[_goodShopModel release];
		_goodShopModel = [goodShopModel retain];
		
	}
}
@end
